string name;

void create()
{
	name = "Unknown user";
}

void init()
{
	writeln("init called at: " + this_object());

	string err = "error test true/false";

	if (err)
		writeln(err);
}

void set_name(string newname)
{
	write("Setting name of this object to a new name...\r\n");
	write("Old name: " + name + "\r\n");
	name = newname;
	write("New name: " + name + "\r\n");
}

void setup()
{
	write("setup called!\r\n");
}

void move(string to)
{
	write("move this object to "+to+"\r\n");
	move_object(to);
}

void process_input(string message)
{
	array parts = explode(message, " ");
    string verb = sizeof(parts) ? parts[0] : "";
    string rest = implode(parts[1..<1], " ");

	writeln("Execute command '" + verb + "' with arguments '"+rest+"'");

	string cmd = "/objs/daemons/commands"->get_command(verb);
	if (cmd)
		cmd->cmd(rest);
	else
	{
		array tokens = parse_command(message);
		if (tokens)
		{
			writeln(tokens);
		}
		else
		{
			writeln("What?");
		}
	}
}

int quit()
{
	writeln("Bye.");
	destruct(this_object());
}